home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 14694 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  702 b 

  1. Path: mcmail.CIS.McMaster.CA!not-for-mail
  2. From: g9326161@mcmail.cis.McMaster.CA (Hong Shen)
  3. Newsgroups: comp.lang.c++
  4. Subject: delete or delete [] ?
  5. Date: 1 Apr 1996 13:36:23 -0500
  6. Organization: McMaster University, Hamilton, Ontario, Canada.
  7. Message-ID: <4jp7n7$f8k@mcmail.CIS.McMaster.CA>
  8. NNTP-Posting-Host: mcmail.cis.mcmaster.ca
  9.  
  10. In almost all of C++ literatures, "delete aa" should be used iff aa is not an 
  11. array and "delete [] aa" should be used iff aa is an array. In following case,
  12. what should I use?
  13.  
  14. typedef int int10[10];
  15. int* aa=new int10; // array of 10 integers.
  16.  
  17. delete aa;
  18.  
  19. or 
  20.  
  21. delete [] aa;
  22.  
  23. For gcc (v2.6), it seems that both work. Which is the standard one?
  24.  
  25. Thanks!
  26.  
  27. Hong Shen
  28.  
  29.